home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
printing
/
vbprintn
/
testapp.frm
< prev
next >
Wrap
Text File
|
1993-07-22
|
11KB
|
380 lines
VERSION 2.00
Begin Form Main
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Print Control Test Application"
ClientHeight = 4965
ClientLeft = 1470
ClientTop = 1890
ClientWidth = 9105
FontBold = -1 'True
FontItalic = -1 'True
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 5370
Icon = TESTAPP.FRX:0000
Left = 1410
LinkMode = 1 'Source
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4965
ScaleWidth = 9105
Top = 1545
Width = 9225
Begin CommandButton Command2
BackColor = &H00C0C0C0&
Caption = "&About..."
Height = 375
Left = 7560
TabIndex = 14
Top = 3960
Width = 1455
End
Begin CommandButton Command1
BackColor = &H00C0C0C0&
Caption = "E&xit"
Height = 375
Left = 7560
TabIndex = 13
Top = 4440
Width = 1455
End
Begin CommandButton TestColumn
BackColor = &H00C0C0C0&
Caption = "Test &Column Output"
Height = 375
Left = 120
TabIndex = 3
Top = 2520
Width = 1935
End
Begin TextBox CompanyName
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 375
Left = 2280
TabIndex = 4
Top = 2760
Width = 6615
End
Begin TextBox TestText
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 1695
Left = 2280
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 2
Top = 720
Width = 6615
End
Begin CommandButton TextTest
BackColor = &H00C0C0C0&
Caption = "Test &Text Output"
Height = 375
Left = 120
TabIndex = 1
Top = 720
Width = 1935
End
Begin CommandButton GraphicsTest
BackColor = &H00C0C0C0&
Caption = "Test &Graphics"
Height = 375
Left = 105
TabIndex = 0
Top = 240
Width = 1935
End
Begin Label PrintPort
BackColor = &H00C0C0C0&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 1680
TabIndex = 12
Top = 4320
Width = 3735
End
Begin Label Label5
BackColor = &H00C0C0C0&
Caption = "Port Name:"
Height = 255
Left = 120
TabIndex = 11
Top = 4320
Width = 1455
End
Begin Label PrintName
BackColor = &H00C0C0C0&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 1680
TabIndex = 10
Top = 4080
Width = 3735
End
Begin Label Label4
BackColor = &H00C0C0C0&
Caption = "Printer Name:"
Height = 255
Left = 120
TabIndex = 9
Top = 4080
Width = 1455
End
Begin Label DLLVersion
BackColor = &H00C0C0C0&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 8.25
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 255
Left = 1680
TabIndex = 8
Top = 3840
Width = 3735
End
Begin Label Label3
BackColor = &H00C0C0C0&
Caption = "DLL Version:"
Height = 255
Left = 120
TabIndex = 7
Top = 3840
Width = 1455
End
Begin Line Line2
BorderWidth = 4
X1 = 120
X2 = 9000
Y1 = 3720
Y2 = 3720
End
Begin Label Label2
BackColor = &H00C0C0C0&
Caption = "Printer Information:"
FontBold = -1 'True
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 12
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 330
Left = 120
TabIndex = 6
Top = 3360
Width = 6210
End
Begin Shape Shape2
BorderColor = &H0000FFFF&
BorderWidth = 3
Height = 375
Left = 6405
Top = 210
Width = 1335
End
Begin Shape Shape1
BorderColor = &H00FF0000&
BorderWidth = 3
Height = 375
Left = 4320
Shape = 2 'Oval
Top = 210
Width = 1575
End
Begin Line Line1
BorderColor = &H000000FF&
BorderWidth = 3
X1 = 2280
X2 = 3960
Y1 = 210
Y2 = 480
End
Begin Label Label1
BackColor = &H00C0C0C0&
Caption = "Your Name Here:"
ForeColor = &H00000000&
Height = 255
Left = 2280
TabIndex = 5
Top = 2520
Width = 2535
End
End
Sub Command1_Click ()
End
End Sub
Sub Command2_Click ()
AboutBox.Show 1
End Sub
Sub Form_Load ()
Dim nMajor As Integer
Dim nMinor As Integer
i% = PrintDLLVersion()
nMajor = i% And 255
nMinor = (i% And 65280) / 256
DLLVersion.Caption = Str$(nMajor) + "." + Str$(nMinor)
DevName$ = String$(255, 0)
i% = PrinterPort(DevName$)
PrintPort.Caption = DevName$
DevName$ = String$(255, 0)
i% = PrinterName(DevName$)
PrintName.Caption = DevName$
End Sub
Sub Form_Unload (Cancel As Integer)
End
End Sub
Sub GraphicsTest_Click ()
Dim i As Integer
Dim Marg As Integer
PrintingDlg.Show
i% = InitializePrinter(Main.hWnd)
i% = PageLayoutSetup(100, 100, 100, 100)
i% = DrawLine(5000, 5000, 10080, 10080)
i% = DrawRectangle(4450, 7000, 8000, 13000)
i% = DrawEllipse(5000, 5000, 7000, 8000)
i% = DrawRndRectangle(2000, 2000, 3000, 15000, 2000, 2000)
i% = DonePrinting()
PrintingDlg.Hide
End Sub
Sub TestColumn_Click ()
Dim nStyle As Integer
Dim i As Integer
Dim rgColumnWidths() As Integer
Dim szHeader As String
ReDim rgColumnWidths(1 To 8)
PrintingDlg.Show
i% = InitializePrinter(Main.hWnd)
szText$ = CompanyName.Text
rgColumnWidths(1) = 150
rgColumnWidths(2) = 300
nStyle = 60
szHeader$ = "Company Name:" + Chr$(9) + szText$
i% = PrintColumnHeaders(szHeader$, 2, rgColumnWidths(1), "Courier New", 12, nStyle%)
szHeader$ = "Address:" + Chr$(9) + "12345 Elm Street"
i% = PrintColumnHeaders(szHeader$, 2, rgColumnWidths(1), "Courier New", 12, nStyle%)
szHeader$ = " " + Chr$(9) + "Anywhere, USA"
i% = PrintColumnHeaders(szHeader$, 2, rgColumnWidths(1), "Courier New", 12, nStyle%)
szHeader$ = "Date:" + Chr$(9) + Date$
i% = PrintColumnHeaders(szHeader$, 2, rgColumnWidths(1), "Courier New", 12, nStyle%)
i% = MoveYPos(100)
rgColumnWidths(1) = 100
rgColumnWidths(2) = 400
rgColumnWidths(3) = 100
nStyle = 32
szHeader$ = "Quantity" + Chr$(9) + "Description" + Chr$(9) + "Price"
i% = PrintColumnHeaders(szHeader$, 3, rgColumnWidths(1), "Arial", 18, nStyle%)
nStyle = 0
i% = SetUpColumns(3, rgColumnWidths(1), "Courier New", 12, nStyle%)
i% = PrintColumnText("6" + Chr$(9) + "Computer 486sx 25Mhz" + Chr$(9) + "$ 3250.54")
i% = PrintColumnText("2" + Chr$(9) + "This is a very long description that shows the ability to wrap text" + Chr$(9) + "$ 34.64")
i% = PrintColumnText("1" + Chr$(9) + "Generic Modem" + Chr$(9) + "$ 145.32")
i% = PrintColumnText("3" + Chr$(9) + "Gross of Fire Crackers " + Chr$(9) + "$ 1.92")
i% = EndColumnPrinting()
i% = DonePrinting()
PrintingDlg.Hide
End Sub
Sub TextTest_Click ()
Dim nStyle As Integer
Dim i As Integer
Dim Marg As Integer
PrintingDlg.Show
i% = InitializePrinter(Main.hWnd)
i% = PageLayoutSetup(100, 100, 100, 100)
' Print it Once
nStyle = 0
i% = StartParagraph("Times New Roman", 12, nStyle%)
szText$ = TestText.Text
i% = ParagraphText(szText$)
i% = FinishParagraph()
i% = SetParagraphSpacing(36, 18)
' Print it Twice
nStyle = 60
i% = StartParagraph("Arial", 18, nStyle%)
szText$ = TestText.Text
i% = ParagraphText(szText$)
i% = FinishParagraph()
i% = SetParagraphSpacing(8, 18)
' Print it a Third time
nStyle = 0
i% = StartParagraph("Courier New", 8, nStyle%)
szText$ = TestText.Text
i% = ParagraphText(szText$)
i% = FinishParagraph()
i% = DonePrinting()
PrintingDlg.Hide
End Sub